<!DOCTYPE html>
<html>
	<!--
    	作者：小七
    	时间：2018-06-27
    	描述：岗位调动表
    -->

	<head>
		<!-- 引入框架文件 -->
		<link rel="stylesheet" href="../../model/bootstrap-3.3.7-dist/css/bootstrap.min.css" />
		<script type="text/javascript" src="../../model/jquery-2.1.0.js"></script>
		<script type="text/javascript" src="../../model/bootstrap-3.3.7-dist/js/bootstrap.js"></script>
		<link rel="stylesheet" href="../../static/css/ehr.css" />
		<link rel="stylesheet" href="../../static/css/employee.css" />
		<script type="text/javascript" src="../../model/models.js"></script>
		<script type="text/javascript" src="../../model/dispose.js"></script>
		<style type="text/css">
			.show th {
				text-align: center;
			}
			
			.show td {
				text-align: center;
			}
		</style>
		<meta charset="UTF-8">
		<title></title>
	</head>

	<body>

		<div include="../../static/header.htm"></div>
		<div style="height: 100%;float: left;" include="../../static/aside.htm"></div>

		<div class="aside2">
			<div include="../../static/staManage.htm"></div>
		</div>

		<div class="section">
			<div style="color: white;font-size: 36px;text-align: center; width: 100%; height: 70px;" class="head"><b>岗位调动表</b></div>
			<div class="content">
				<form id="quitQuery">
					<div class="">
						<span style="margin-top: 7px;">开始时间：</span>
						<input id="beginDate" name="beginDate" value="2016-06-07" type="date" class="form-control" style="width: 150px; float: left;margin-right: 10px;" />
						<span style="margin-top: 7px;">结束时间：</span>
						<input id="endDate" name="endDate" value="2018-09-03" type="date" class="form-control" style="width: 150px; float: left;margin-right: 10px;" />
						<input class="btn btn-primary" type="submit" value="查询" />
						<input type="hidden" value="1" id="page" name="page" />
					</div>
				</form>

				<div class="show">
					<table class="table table-striped">
						<thead>
							<tr>
								<th>序号</th>
								<th>部门名称</th>
								<th>原岗位名称</th>
								<th>新岗位名称</th>
								<th>姓名</th>
								<th>性别</th>
								<th>调动日期</th>
								<th>调动原因</th>
							</tr>
						</thead>
						<tbody id="quitList">
							<tr>
								<td></td>
								<td></td>
								<td></td>
								<td></td>
								<td></td>
								<td></td>
								<td></td>
							</tr>
						</tbody>
					</table>
					<!-- 分页开始 -->
					<nav style="position: absolute; bottom: 20px;" aria-label="Page navigation">
						<ul id="pagination" class="pagination">
							<li>
								<a href="#" aria-label="Previous">
									<span aria-hidden="true">&laquo;</span>
								</a>
							</li>
							<li>
								<a href="#" aria-label="Next">
									<span aria-hidden="true">&raquo;</span>
								</a>
							</li>
						</ul>
					</nav>

					<!-- 分页结束 -->

				</div>
			</div>
		</div>
	</body>

</html>

<script type="text/javascript">
	// 查询封装
	function findByKeySta($self, page) {
		$.ajax({
			type: "post",
			url: "http://localhost:9090/findPostTurnSta",
			"data": $self.serialize(),
			"success": function(obj) {
				if(obj.code == 1) {
					var list = obj.data;
					var $tbody = $("#quitList");
					$tbody.html("");

					for(var i = 0; i < list.length; i++) {
						var $tr = $("<tr></tr>");

						$tr.append("<td>" + (i + 1) + "</td>");
						var staff = list[i];
						// 分页组件初始化
						upPage("pagination", obj.page);
						
						var emp = staff.postEmp;

						if(null != emp) {
							if(null != emp.empDiv) {
								$tr.append("<td>"+ emp.empDiv.depaName +"</td>");
							}
							else {
								$tr.append("<td>无</td>");
							}
						} else {
							$tr.append("<td>无</td>");
						}
				
						$tr.append("<td>" + staff.frontPost.postName + "</td>");
						$tr.append("<td>" + staff.turnPost.postName + "</td>");
						if(null != emp) {
							$tr.append("<td>"+emp.empName+"</td>");
							$tr.append("<td>"+emp.empSex+"</td>");
						}
						
						$tr.append("<td>" + staff.turnDate + "</td>");
						$tr.append("<td>" + staff.turnCause + "</td>");
						
						$tbody.append($tr);
					}
				}
			},
			"dataType": "json",
			async: true
		});
	};

	$("#quitQuery").submit(function(e) {
		e.preventDefault();

		var $self = $(this);

		findByKeySta($self, 1);
	});

	function pageSkip(page) {
		$("#page").val(page);
		$("#quitQuery").submit();
	}
</script>